<!--

    Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
    <h:head>
        <h:outputStylesheet library="css" name="main.css" />
    </h:head>

    <h1>Testing dimensions</h1>
    
    <ul>
        
        <li>component-family: UISelectOne, UISelectMany</li>
        
        <li>item style: individual f:selectItem instances, f:selectItems</li>
        
        <li>pass through attribute style: f:passThroughAttribute, f:passThroughAttribute, prefixed attribute</li>
        
    </ul>
    
    <div class="content">
    
<h:form id="form_selectOne">

    <p>Current fruitValue: #{bean.fruitValue}</p>

    <p>Current nameValue: #{bean.nameValue}</p>
    
    <p>Current hobbitValue: #{bean.hobbitBean}</p>

    <p>Current groupedNameValue: #{bean.groupedNameValue}</p>

    <h:commandButton id="button" value="submit" />

    <p>Messages: <h:messages /></p>
    
    <h2>UISelectOne, f:selectItem f:passThroughAttribute</h2>
    
    <h:selectOneMenu id="selectOne_selectItem_passThroughAttribute" value="#{bean.fruitValue}">
        <f:selectItem itemLabel="Apple" itemValue="Apple">
            <f:passThroughAttribute name="data-apple" value="apple-data" />
        </f:selectItem>
        <f:selectItem itemLabel="Orange" itemValue="Orange">
            <f:passThroughAttribute name="data-orange" value="orange-data" />
        </f:selectItem>
        <f:selectItem itemLabel="Pear" itemValue="Pear">
            <f:passThroughAttribute name="data-pear" value="pear-data" />
        </f:selectItem>
        
    </h:selectOneMenu>
    
    <h2>UISelectOne, f:selectItems f:passThroughAttribute</h2>
    
    <h:selectOneMenu id="selectOne_selectItem_passThroughAttributes_stringArray" value="#{bean.nameValue}">
        <f:selectItems value="#{selectMany05Bean.arrayValues}">
            <f:passThroughAttribute name="data-array" value="array-data" />
        </f:selectItems>
        
    </h:selectOneMenu>
    
    <br></br>

    <h:selectOneMenu value="#{bean.hobbitBean}" id="selectOne_selectItem_passThroughAttribute_beanCollection" >
        <f:selectItems value="#{selectMany05Bean.hobbitCollection}">
            <f:passThroughAttribute name="data-collection" value="collection-data" />
        </f:selectItems>
        <f:converter converterId="hobbit-converter" />
        
    </h:selectOneMenu>
    
    <br></br>

    <h:selectOneMenu value="#{bean.groupedNameValue}" id="selectOne_selectItem_selectItemGrouped">
        <f:selectItems value="#{selectMany05Bean.groupedItems}">
            <f:passThroughAttribute name="data-grouped" value="grouped-data" />
        </f:selectItems>
        
    </h:selectOneMenu>

</h:form>
        
    </div>
    
    <div class="content">
        
    
<h:form id="form_selectMany">
    
    <p>Current nameValueList: #{bean.nameValueList[0]} #{bean.nameValueList[1]}</p>
    
    <p>Current hobbitList: #{bean.hobbitBeanList[0]} #{bean.hobbitBeanList[1]}</p>
    
    <p>Current groupedItems: #{bean.groupedNameValueList[0]} #{bean.groupedNameValueList[1]}</p>
    
    <h:commandButton id="button" value="submit" />
    
    <h2>UISelectMany, f:selectItems f:passThroughAttribute</h2>
    
    <h:selectManyListbox  id="selectMany_selectItem_passThroughAttributes_stringArray" value="#{bean.nameValueList}">
        <f:selectItems value="#{selectMany05Bean.arrayValues}">
            <f:passThroughAttribute name="data-array" value="array-data" />
        </f:selectItems>
        
    </h:selectManyListbox>
    
    <br></br>

    <h:selectManyListbox value="#{bean.hobbitBeanList}" id="selectMany_selectItem_passThroughAttribute_beanCollection" >
        <f:selectItems value="#{selectMany05Bean.hobbitCollection}">
            <f:passThroughAttribute name="data-collection" value="collection-data" />
        </f:selectItems>
        <f:converter converterId="hobbit-converter" />
        
    </h:selectManyListbox>
    
    <br></br>

    <h:selectManyListbox value="#{bean.groupedNameValueList}" id="selectMany_selectItem_selectItemGrouped">
        <f:selectItems value="#{selectMany05Bean.groupedItems}">
            <f:passThroughAttribute name="data-grouped" value="grouped-data" />
        </f:selectItems>
        
    </h:selectManyListbox>
    
    
</h:form>
        
    </div>
    
</html>
